var express = require('express');
var router = express.Router();

const { getLogs, searchLogs, logsDelete } = require('../service/logsService');

router.get('/getLogs', async function(req, res, next) {
    const result = await getLogs();
    res.send(result);
});

router.post('/searchLogs', async function(req, res, next) {
    const result = await searchLogs(req.body.keyWord);
    res.send(result);
});

router.delete('/delete/:id', async function(req, res, next) {
    console.log(req.params.id);
    await logsDelete(req.params.id);
    res.send({ status: 1 });
});

module.exports = router;